package com.gistone.commis.mapper;

import com.gistone.commis.entity.OfficeSuppliesChange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.sql.Date;

@Mapper
public interface OfficeSuppliesChangeMapper {
    int deleteByPrimaryKey(Integer changeId);

    int insert(OfficeSuppliesChange record);

    int insertSelective(OfficeSuppliesChange record);

    OfficeSuppliesChange selectByPrimaryKey(Integer changeId);
    @Select("SELECT count(*) FROM tb_office_supplies_change WHERE supplies_id = #{id}")
    int selectByWorkId(Integer id);

    @Select("SELECT current_datetime FROM tb_office_supplies_change where supplies_id = #{id} order by current_datetime desc limit 1 ")
    Date selectLastDate(Integer id);


    @Select("SELECT amount FROM tb_office_supplies_change WHERE supplies_id = #{id} order by change_id desc limit 0,1")
    double getNewlyAmountById(Integer id);

    int updateByPrimaryKeySelective(OfficeSuppliesChange record);

    int updateByPrimaryKey(OfficeSuppliesChange record);
}